package com.lx;

import com.lx.config.LeyouConfig;
import com.lx.pojo.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {
        //如果完全使用了配置类，只能通过AnnotationConfig上下文来获取容器，通过配置类的class对象来加载
        ApplicationContext context = new AnnotationConfigApplicationContext(LeyouConfig.class);
        User user = context.getBean("newUser", User.class);
        System.out.println(user.getName());
    }
}
